2abbafd6c39d22bf05dd0bbbc10b3cf3a24e305f,app/src/main/java/com/zfdang/zsmth_android/MainActivity.java,MainActivity,onNewIntent,#Intent#,338
Before Change
// http://www.androiddesignpatterns.com/2013/08/fragment-transaction-commit-state-loss.html
// http://stackoverflow.com/questions/7575921/illegalstateexception-can-not-perform-this-action-after-onsaveinstancestate-wit
// java.lang.IllegalStateException: Can not perform this action after onSaveInstanceState
fm.beginTransaction().replace(R.id.content_frame, mailListFragment).commitAllowingStateLoss();
}
}
After Change
// http://stackoverflow.com/questions/7575921/illegalstateexception-can-not-perform-this-action-after-onsaveinstancestate-wit
// java.lang.IllegalStateException: Can not perform this action after onSaveInstanceState
String message = bundle.getString(SMTHApplication.SERVICE_NOTIFICATION_MESSAGE);
if(message != null) {
// find the actual folder for the new message
if(message.contains(SMTHApplication.NOTIFICATION_NEW_MAIL)) {
mailListFragment.setCurrentFolder(MailListFragment.INBOX_LABEL);
} else if(message.contains(SMTHApplication.NOTIFICATION_NEW_LIKE)) {
mailListFragment.setCurrentFolder(MailListFragment.LIKE_LABEL);
} else if(message.contains(SMTHApplication.NOTIFICATION_NEW_AT)) {
mailListFragment.setCurrentFolder(MailListFragment.AT_LABEL);
} else if(message.contains(SMTHApplication.NOTIFICATION_NEW_REPLY)) {
mailListFragment.setCurrentFolder(MailListFragment.REPLY_LABEL);
}
fm.beginTransaction().replace(R.id.content_frame, mailListFragment).commitAllowingStateLoss();
}
}
}